package experiment4;

public class No_1 {
    public static void main(String []args)
    {
        Stock a=new Stock();
        a.symbol="0RCL";
        a.name="Oracle Corporation";
        a.previousClosingPrice=34.5;
        a.currentPrice=34.35;
        System.out.println("变化率是"+a.getChangePercentO()*100+"%");
    }


}
class Stock{

    String symbol;//股票代码
    String name;//股票名字
    double previousClosingPrice;
    double currentPrice;

    public Stock(){
    }
    public Stock(String new_symbol,String new_name,double new_previousClosingPrice,double new_currentPrice){
        symbol=new_symbol;
        name=new_name;
        currentPrice=new_currentPrice;
        previousClosingPrice=new_previousClosingPrice;

    }
    public double getChangePercentO()
    {
        return (currentPrice-previousClosingPrice)/previousClosingPrice;
    }
}
